const express = require('express');
const router = express.Router();
const sys_config=require('../../../models/sys_config')

router.post('/sys/config/save', async(req, res) => {
    try {
        const{backLogo,copyRight,id,siteName}=req.body

        // 调用数据库方法保存配置项
        await sys_config.updateSiteName(siteName,id)
        await sys_config.updateCopyRight(copyRight,id)
        await sys_config.updateBackLogo(backLogo,id)

        return res.json({
            "msg": "操作成功！",
            "code": 0,
            "data": {
                "id": id
            },
            "success": true
        })
    } catch (error) {
        console.error(error);
        return res.status(500).json({ message: 'Internal server error' });
    }
});

module.exports=router